package crontab

import (
	"github.com/robfig/cron"
	"qabx.net/common"
	env "qabx.net/safe-app-center/pkg/config/env"
	"qabx.net/safe-app-center/pkg/monitor"
)

type CronTab struct {
}

func (s *CronTab) StartCronJob() {

	//定时处理心跳包数据
	c := cron.New()
	_ = c.AddJob("*/"+common.Int64ToString(env.Options.PrometheusCronTime)+" * * * * *", monitor.PrometheusCron{})
	c.Start()

	//每日凌晨清理prometheus数据
	resetCron := cron.New()
	_ = resetCron.AddJob("0 0 0 * *", monitor.ResetCounter{})
	resetCron.Start()

	select {}
}
